<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>   
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>附件</title>    
	
	<link rel="stylesheet"
		href="${pageContext.request.contextPath}/css/member/style.css"
		type="text/css"></link>
	<link rel="stylesheet"
		href="${pageContext.request.contextPath}/css/member/page.css"
		type="text/css"></link>
	<script type="text/javascript"
		src="${pageContext.request.contextPath}/jslib/jquery-1.9.1.min.js"></script>	
	<link rel="stylesheet" type="text/css" 
		href="${pageContext.request.contextPath}/jslib/swfupload/swfupload.css">
	<script type="text/javascript" 
		src="${pageContext.request.contextPath}/jslib/swfupload/swfupload.js" charset="utf-8"></script>
	<script type="text/javascript" 
		src="${pageContext.request.contextPath}/jslib/swfupload/swfupload.queue.js" charset="utf-8"></script>
	<script type="text/javascript" 
		src="${pageContext.request.contextPath}/jslib/swfupload/fileprogress.js" charset="utf-8"></script>
	<script type="text/javascript" 
		src="${pageContext.request.contextPath}/jslib/swfupload/handlers.js" charset="utf-8"></script>
    
  </head>
  
  <body>
  	<s:form id="attachForm"  method="post" name="thisform" enctype="multipart/form-data">
  	<div id="controller" class="fieldset flash" style="width: 500px; height: 300px">
  		<span id="spanButtonPlaceholder1"></span>
  		<div class="fieldset flash" id="fsUploadProgress1" style="width: 460px; height: 200px">
  		</div>
  		<div style="padding-left: 350px;">
			<input id="btnUpload1" type="button" value="开始上传" 
				style="margin-left: 2px; height: 22px; font-size: 8pt;" />			
			<input id="btnCancel1" type="button" value="中断上传" 
				disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;" />
			<br />
		</div>
  	</div>
  	<div id="bottomTool" style="padding-left: 450px;">
  		<input id="btnEnter" type="button" value="确定" 
			style="margin-left: 2px; height: 22px; font-size: 12pt;" />				
  	</div>
    </s:form>       
  </body>
  <script type="text/javascript" charset="utf-8"> 
	var upload1;
	$(function(){
		upload1 = new SWFUpload({
				// Backend Settings
			upload_url: "${pageContext.request.contextPath}/${uploadConf.upload_url}", //这里的action不可以删除
			post_params: {"uploadType" : "${uploadConf.uploadType}","linkguid" : "${uploadConf.linkguid}","devuid":"${uploadConf.devuid}"},
			file_post_name: "file",
			// File Upload Settings
			file_size_limit : "${uploadConf.file_size_limit}",	// 100MB  //文件大小设定
			file_types : "${uploadConf.file_types}",//文件上传类型现在
			file_types_description : "${uploadConf.file_types_description}",
			file_upload_limit : "${uploadConf.file_upload_limit}",
			file_queue_limit : "0",

			// Event Handler Settings (all my handlers are in the Handler.js file)
			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,

			// Button Settings   button的图片
			button_image_url : "${pageContext.request.contextPath}/jslib/swfupload/XPButtonUploadText_61x22.png",
			button_placeholder_id : "spanButtonPlaceholder1",
			button_width: 61,
			button_height: 22,
			
			// Flash Settings
			flash_url : "${pageContext.request.contextPath}/jslib/swfupload/swfupload.swf",
			

			custom_settings : {
				progressTarget : "fsUploadProgress1",
				cancelButtonId : "btnCancel1"
			
			},
			
			// Debug Settings
			debug: false
		});
		
		$('#attachForm').attr("action","${pageContext.request.contextPath}/system/uploadAttach.shtml");
		//开始上传
		$('#btnUpload1').click(function(){
			upload1.startUpload();
		});
		//中止上传
		$('#btnCancel1').click(function(){
			cancelQueue(upload1);
		});
		
		//确定
		$('#btnEnter').click(function(){
			var index = parent.layer.getFrameIndex();			
			parent.layer.close(index);
		});
	});	
  </script>
</html>
